package  com.game.raceroom.player.effect.skill
{
	import flash.utils.getTimer;
	
	import com.game.raceroom.player.Player;
	import com.game.raceroom.player.effect.Effect;
	public class JumpEffect extends Effect
	{   
		private var actor:Player;

		public function JumpEffect(actor:Player)
		{  
			this.actor=actor;
			var id=actor._parent.acCanvas.getChildIndex(actor.actorDisp);
			var obj=actor._parent.acCanvas.getChildAt(actor._parent.acCanvas.numChildren-1);
			actor._parent.acCanvas.setChildIndex(obj,id);
			actor._parent.acCanvas.setChildIndex(actor.actorDisp,actor._parent.acCanvas.numChildren-1);
			this.effectType= EFFECT_TYPE_JUMP;
			startTime=getTimer();
			maxTime=1500;
		 }
         public function getShowStep():int{
         	var time:int=getTimer()-startTime;
 
         	if(time>maxTime+500)return 999;
         	else
         	 return Math.floor(time/50);
         	return 0;
         }
         
        private function zoom(scale:Number):void{
        	//trace("scale "+scale);
            actor.actorDisp.setScale(scale);
            //actor.actorDisp.drawActor(actor.actorDisp.c_x,actor.actorDisp.c_y);
             
            // trace(actor.actorDisp.mc.x);
            //  trace(actor.actorDisp.mc.y);
         }
         private var scale:Number=1.0;
         public override function update():Boolean{
			   
         	   var step:int=getShowStep();
         	   
         	   switch(step){
         	   	   case 0:
         	   	   scale=1.06;
         	   	   break;
         	   	   case 1:
         	   	   scale=1.12;
         	   	   break;
         	   	   case 2:
         	   	   scale=1.17;
         	   	   break;
         	   	   case 3:
         	   	   scale=1.22;
         	   	   break;
         	   	   case 4:
         	   	   scale=1.26;
         	   	   break;
         	   	   case 5:
         	   	   scale=1.3;
         	   	   break;
         	   	   case 6:
         	   	   scale=1.33;
         	   	   break;
         	   	   case 7:
         	   	   scale=1.36;
         	   	   break;
         	   	   case 8:
         	   	   scale=1.38;
         	   	   break;
         	   	   case 9:
         	   	   scale=1.4;
         	   	   break;
         	   	   case 10:
         	   	   scale=1.42;
         	   	   break;
         	   	   case 11:
         	   	   scale=1.44;
         	   	   break;
         	   	   case 12:
         	   	   scale=1.45;
         	   	   break;
         	   	   case 13:
         	   	   scale=1.46;
         	   	   break;
                   case 14:
                   case 15:
         	   	   scale=1.47;
         	   	   break;
  
         	   	   case 16:
         	   	   scale=1.46;
         	   	   break; 
         	   	   case 17:
         	   	   scale=1.45;
         	   	   break; 
         	       case 18:
         	       scale=1.44;
         	   	   break;
         	   	   case 19:
         	   	   scale=1.45;
         	   	   break; 
         	   	   case 20:
         	   	   scale=1.4;
         	   	   break; 
         	   	   case 21:
         	   	   scale=1.38;
         	   	   break;  
         	   	   case 22:
         	   	   scale=1.36;
         	   	   break;
         	   	   case 23:
         	   	   scale=1.33;
         	   	   break; 
         	   	   case 24:
         	   	   scale=1.3;
         	   	   break; 
         	   	   case 25:
         	   	   scale=1.26;
         	   	   break;  
                   case 26:
         	   	   scale=1.22;
         	   	   break; 
         	   	   case 27:
         	   	   scale=1.17;
         	   	   break; 
                   case 28:
         	   	   scale=1.12;
         	   	   break;
         	       case 29:
         	   	   scale=1.06;
         	   	   break;  
                   case 30:
         	   	   scale=1.00;
         	   	   break; 
         	   	   case 31:
         	   	   scale=0.98;
         	   	   break; 
                   case 32:
         	   	   scale=1.06;
         	   	   break;
         	   	   case 33:
         	   	   scale=1.10;
         	   	   break;
         	   	   case 34:
         	   	   scale=1.06;
         	   	   break;
         	   	   case 35:
         	   	   scale=1.00;
         	   	   break;
         	   	   case 36:
         	   	   scale=1.05;
         	   	   break;
         	   	   case 999:
         	   	   scale=1.0;
         	   	   valid=false;
         	   	   break;
         	   	   default:
         	   	   scale=1.0;
         	   	   break;
         	   }
         	   zoom(scale); 
        	   return true;
         }
	}
}